<?php

namespace app\admin\controller;
use think\Loader;
use think\Db;

class Order extends Common
{
    public function index()
    {
        $sou = request()->param();
        $open_time = input("open_time")?"open_time = '".input("open_time")."'":($sou["open_time"]="");
        $nickname = input("nickname")?input("nickname"):($sou["nickname"]="");
        $close_type = input("close_type")?"close_type = '".input("close_type")."'":($sou["close_type"]="1=1");
        $admin_id = input("merchant_id")?"o.merchant_id = '".input("merchant_id")."'":($sou["merchant_id"]="o.id=o.id");
        $DB = Db::name("member_order")
            ->alias("o")
            ->join("member m","member_id=m.id")
            ->where("m.nickname like '%$nickname%'")
            ->where($close_type)
            ->where($open_time)
            ->where($admin_id)
            ->field(["o.id oid", 'm.id', 'symbol_cn','contract_size','open_time','open_price','close_time','close_price','service_fee','deposit','profit','overfee','close_type','m.nickname'])
            ->paginate(10,false,['query'=>request()->param()]);
//        print_r($DB);
//        echo DB::table('member_order')->getlastsql();
        $admin = Db::name("admin")->field(["id","username"])->select();
        return view("list",["arr"=>$DB,"sou"=>$sou,"admin"=>$admin]);
    }
}
















































